//
//  WmcLocalAlbumCell.swift
//  YPWatermarkCamera
//
//  Created by 赵新 on 2022/3/28.
//

import UIKit

class WmcLocalAlbumCell: WmcBaseCollectionCell {
    
    override func makeUI() {
        
        imageView.layer.cornerRadius = 4
        imageView.layer.masksToBounds = true
        addSubview(imageView)
        imageView.snp.makeConstraints { make in
            make.edges.equalToSuperview()
        }
        
        addSubview(playerImageView)
        playerImageView.snp.makeConstraints { make in
            make.center.equalToSuperview()
            make.size.equalToSuperview().multipliedBy(0.3)
        }
    }

    func configModel(_ model: WmcLocalMediaAlbumDBManager.DBModel) {
        imageView.image = .init(contentsOfFile: model.previewImagePath)
        switch model.mediaType {
        case .image:
            playerImageView.isHidden = true
        case .video:
            playerImageView.isHidden = false
            
        default: break
        }
    }
    
    lazy var playerImageView: UIImageView = {
        let imageView = UIImageView(image: "player_play_center".wmc_image)
        imageView.contentMode = .scaleAspectFit
        return imageView
    }()
}
